#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
@Project : gtmsAutoTestProject 
@File    : pos_device_save_interface.py
@IDE     : PyCharm 
@Author  : Mario
@Date    : 2022/7/22 10:24 
@Describe: POS设备新建请求接口入口
"""
from fastapi import APIRouter
from Comm.logUtils.logControl import LogHandler
from FastApi.server.middle.setup.pos.pos_device_save_server import PosDeviceSave
from FastApi.dto.middle.setupDto.pos.pos_device_save_dto import PosDeviceSaveDto

logger = LogHandler().get_logger()
posDeviceSave_router = APIRouter()


@posDeviceSave_router.post("/device/save", name="POS设备新建")
async def posDeviceSave(payload: PosDeviceSaveDto):
    logger.info('请求参数:[{}]'.format(payload))
    requests = PosDeviceSave(payload.environment)
    response_data = requests.request_parameter_verification(payload.brandCode, payload.deviceName, payload.deviceMac, payload.printerIp, payload.deviceStatus)
    logger.info('接口响应:[{}]'.format(response_data))
    return response_data
